import React, { FC, useMemo, useCallback } from "react";
import { Input } from "antd";

interface InputPasswordProps {
    disabled?: boolean | undefined,
    value: any,
    onChange: Function
}

const InputPassword: FC<InputPasswordProps> = (props) => {

    const handelChange: Function = useCallback((e: any) => {
        props.onChange && props.onChange(e.target.value);
    }, [props.onChange]);

    const renderInputPassword = useMemo(() => {
        return (
            <Input.Password disabled={props.disabled} onChange={handelChange} />
        )
    }, [props]);

    return (renderInputPassword);
};

export default InputPassword;